|
|
|
|
|
|
|
So far in the discussions of accessing databases, the focus has been on using PC-based databases. These types of databases include Access, FoxPro, dBase, and Paradox. However, Visual Basic is also a great tool for creating front ends for client/server applications. These types of applications are used to access data stored in database servers such as SQL Server and Oracle. Most of your front-end worksuch as designing forms and writing code to process informationwill be the same whether you are writing an application for a PC database or a client/server database. The key difference is in how you make the connection to the data. |
|
|
|
|
|
|
|
|
This chapter discusses how your Visual Basic programs can easily access data stored in a variety of remote locations through the use of Remote Data Objects (RDO). You'll see how the addition of RDO to Visual Basic's repertoire makes short work of writing applications that need to work with remote data. |
|
|
|
|
|
|
|
|
Database Access Philosophies |
|
|
|
|
|
|
|
|
Before delving further into actually setting up applications that access client/server databases, you'll take a look at the difference in the philosophy of the two types of database access. In the PCdatabase world, information is accessed through the database engine, which is part of the application. For Visual Basic, the Jet engine is a part of your database applications. As you issue commands to retrieve information from the database, the commands are interpreted by the Jet engine and the processing of the commands is done locally on your PC. Regardless of whether the database file actually resides on your PC or is located on a file server, the database engine remains on your PC. The application itself contains the logic to directly access the database file. In the client/server world, this is not the case. Your application issues a request for information, usually in the form of a SQL statement. This request is passed to the database server, which processes the request and returns the results. This is true client/server computing, in which a database server does the actual processing of the request. |
|
|
|
|
|
|
|
|
Client/server systems have a number of advantages over just sharing a database file. First, database logic is removed to a central, more maintainable location. For example, suppose you have a program that calculates sales tax based on your company's rules. In a client/server environment, the logic for this calculation process would be located on the database server. This means you can make changes to it in one place, without having to rewrite the client application. Other advantages include being able to distribute processing and separating the user interface design from the business logic. |
|
|
|
|
|
|
|
|
One method used by Visual Basic to communicate with client/server databases is called Open Database Connectivity, or ODBC. ODBC is a component of Microsoft's Windows Open System Architecture (WOSA). ODBC provides a set of application program interface (API) functions, which makes it easier for a developer to connect to a wide range of database formats. Because of the use of ODBC standards, you can use the same set of functions and commands to access information in a SQL Server, Oracle, or Interbase server, even though the actual data-storage |
|
|
|
|
|